﻿using System.Web.Http.Routing;

namespace Inovout.Web.Http
{
    public static class HttpRouteDataExtensions
    {
        public static IHttpRouteData GetMergeRoutes(this IHttpRouteData routeData)
        {
            var subRoutes = routeData.GetSubRoutes();
            if (subRoutes != null)
            {
                foreach (var subRoute in subRoutes)
                {
                    foreach (var value in subRoute.Values)
                    {
                        routeData.Values[value.Key] = value.Value;
                    }
                }
            }
            return routeData;
        }
    }
}
